package com.healthshare.parse.share;

import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.healthshare.parse.news.NewsListParse.NewsLisItem;
import com.healthshare.parse.news.TitleListParse.TitleListItem;
import com.palmedia.framework.parse.BaseParse;




/**
 * @author xudeliang
 * 分享列表
 */
public class ShareListParse extends BaseParse
{

	/*{
		　“sharelist ”:[
{"contentid":"3232",“timestamp”:”21212121”,”logourl”:”http://xxxx.xxxx.xxx/32.png” ,"nickname":"三娃","content":"气管炎的治疗经验",
"cmtnum":"12","collectnum":"20","picurl":"http://xxx.xxx.xxx/232.jpg" ,"timetype":"0","timevalue":"5"}，


	*/

	
	public ArrayList<ShareListItem> shareListItem = new ArrayList<ShareListItem>();
	
	public ShareListParse()
	{
		
	}
	
	
	@Override
	public boolean Parse(byte[]data)
	{
		boolean ret = super.Parse(data);
		if(!ret)
		{
			return false;
		}
		if(JSON==parseType)
		{
			try 
			{
				JSONArray ja = jsonObject.getJSONArray("sharelist");
				int len = ja.length();
				for(int i=0;i<len;i++)
				{
					ShareListItem kv = new ShareListItem();
					
					JSONObject iobject =ja.getJSONObject(i);
					kv.contentid = iobject.getString("contentid");
					kv.timestamp = iobject.getString("timestamp");
					kv.logourl = iobject.getString("logourl");
					kv.nickname = iobject.getString("nickname");
					kv.content = iobject.getString("content");
					kv.cmtnum = iobject.getString("cmtnum");
					kv.collectnum = iobject.getString("collectnum");
					kv.picurl = iobject.getString("picurl");
					kv.timetype = iobject.getString("timetype");
					kv.timevalue = iobject.getString("timevalue");
					shareListItem.add(kv);
				}
				return true;
			} 
			catch (JSONException e) 
			{
				e.printStackTrace();
			}
		}
		return false;
	}
	
	public class ShareListItem
	{
		public String contentid;
		public String timestamp;
		public String logourl;
		public String nickname;
		public String content;
		public String cmtnum;
		public String collectnum;
		public String picurl;
		public String timetype;
		public String timevalue;
	}
}
